<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../lib/bootstrap-3.3.5-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/index.css">
    <link rel="stylesheet" href="../css/order.css">
    <link rel="stylesheet" href="../css/zx.css">
    <link rel="stylesheet" href="../font/iconfont.css">
    <script src="../lib/bootstrap-3.3.5-dist/js/jquery-1.11.3.js"></script>
    <script src="../lib/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
</head>

<body>
    <div class="container-fluid " id="orderpage">
        <div class="kk"></div>
        <div id="cateHead">
            <p></p>
            <div class="litlehead litlehead2">
                <span>首页</span>
                <span>/</span>
                <span>商城系统</span>
                <span>/</span>
                <span>订单管理</span>
                <span>/</span>
                <span>订单详情</span>
            </div>
            <p class="litlehead_p">订单详情_代付款</p>
        </div>
    </div>
    <div id="order_con1" class="clear">
        <div>
            <p class="iconfont icon-duigouxiao"></p>
            <p>提交订单</p>
        </div>
        <div class='xian2'></div>
        <div>
            <p class="iconfont icon-2 icon"></p>
            <p>支付订单</p>
        </div>
        <div class='xian2'></div>
        <div>
            <p class="iconfont icon-3 icon"></p>
            <p>订单发货</p>
        </div>
        <div class='xian2'></div>
        <div>
            <p class="iconfont icon-4 icon"></p>
            <p>确认收货</p>
        </div>
        <div class='xian2'></div>
        <div>
            <p class="iconfont icon-5 icon"></p>
            <p>完成评论</p>
        </div>
    </div>
    <div id="order_con2">
        <div id="caozuo">
            <span>当前订单状态：<span>待付款</span></span>
            <div>
                <button data-toggle="modal" data-target="#myModal">修改收货信息</button>
            </div>
        </div>
        <p class="biaoti">基础信息</p>
        <div class="order_div1">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>订单编号</th>
                        <th>发货单号</th>
                        <th>用户账号</th>
                        <th>支付方式</th>
                        <th>订单来源</th>
                    </tr>
                </thead>
                <tbody id="order_tbody1">
                </tbody>
            </table>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>配送方式</th>
                        <th>自动确认收货时间</th>
                        <th>活动信息</th>
                        <th></th>
                        <th></th>
                    </tr>
                </thead>
                <tbody id="order_tbody2">
                </tbody>
            </table>
        </div>
        <p class="biaoti">收货人信息</p>
        <div>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>收货人</th>
                        <th>联系方式</th>
                        <th>邮政编码</th>
                        <th>收货地址</th>
                    </tr>
                </thead>
                <tbody id="order_tbody3">
                </tbody>
            </table>
        </div>
        <p class="biaoti">商品信息</p>
        <div>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th class="mypic">商品图片</th>
                        <th>商品名称</th>
                        <th>价格</th>
                        <th>编码</th>
                        <th>数量</th>
                        <th>小计</th>
                    </tr>
                </thead>
                <tbody id="order_tbody4">
                </tbody>
            </table>
        </div>
    </div>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">修改收货人信息</h4>
                </div>
                <div class="modal-body">
                    <table id="mymotable">
                        <tr>
                            <td>收货人姓名：</td>
                            <td><input type="text" id="order_name"></td>
                        </tr>
                        <tr>
                            <td id="tel">手机号码：</td>
                            <td><input type="text" id="order_tel"></td>
                        </tr>
                        <tr>
                            <td>邮政编码：</td>
                            <td><input type="text" id="order_you"></td>
                        </tr>
                        <tr>
                            <td>所在区域：</td>
                            <td>
                                <select name="" id="sheng">
                                    <option value="">省份</option>
                                    <option value="北京">北京</option>
                                    <option value="上海">上海</option>
                                    <option value="四川">四川</option>
                                </select>
                                省
                                <select name="" id="shi">
                                    <option value="">市区</option>
                                    <option value="北京">北京</option>
                                    <option value="上海">上海</option>
                                    <option value="成都">成都</option>
                                </select>
                                市
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="save" data-dismiss="modal">保存</button>
                </div>
            </div>
        </div>
    </div>
    <script src="../JavaScript/data.js"></script>
    <!-- <script src="../JavaScript/mall.js"></script> -->
    <script src="../JavaScript/utils.js"></script>
    <script src="../JavaScript/index.js"></script>
    <script>
        let order1_data = 0
        let myorderdata = getmyData('orderData')
        let order_user
        let quanju
        order1_data = getmyData('order_next')
        myorderdata.forEach((item, index) => {
            if (item.orderCode == order1_data) {
                order_user = item
                quanju = index
            }
        });
        console.log(order_user)
        $("#order_tbody1").html(`
        <tr>
            <td>${order_user.orderCode}</td>
            <td>${order_user.orderStatus}</td>
            <td>${order_user.account}</td>
            <td>${order_user.orderMethod}</td>
            <td>${order_user.orderSource}</td>
        </tr>
        `)
        $("#order_tbody2").html(`
        <tr>
            <td>${order_user.orderStatus}</td>
            <td>15天</td>
            <td>首单满减免10元</td>
            <td></td>
            <td></td>
        </tr>
        `)
        let orderuser = getset(userData, "userData")
        let myorderuser = 0
        orderuser.forEach(item => {
            if (item.account == order_user.account) {
                myorderuser = item
            }
        });
        $("#order_tbody3").html(`
        <tr id='tbody3'>
            <td>${myorderuser.nickName}</td>
            <td>${myorderuser.telephone}</td>
            <td>100010</td>
            <td>北京市朝阳区望京SOHO</td>
        </tr>
        `)
        var mygoods = getmyData("goods")
        if (mygoods == null) {
            setmyData("goods", categoryData)
            mygoods = getmyData("goods")
        }
        let mygoods_order = 0
        mygoods.forEach(item => {
            if (item.goodsName == order_user.goodsName) {
                mygoods_order = item
            }
        });
        $("#order_tbody4").html(`
        <tr>
            <td>${mygoods_order.goodsImg}</td>
            <td>${mygoods_order.goodsName}</td>
            <td>${mygoods_order.goodsPrice}</td>
            <td>${mygoods_order.goodsCode}</td>
            <td>1</td>
            <td>${mygoods_order.goodsPrice}</td>
        </tr>
        <tr>
            <td class='heji' colspan="6">合计：${mygoods_order.goodsPrice}</td>
        </tr>
        `)
        $("#save").click(function () {
            if ($("#order_name").val() != '') {
                $("#tbody3").children().eq(0).text(`${$("#order_name").val()}`)
            }
            if ($("#order_tel").val() != '') {
                $("#tbody3").children().eq(1).text(`${$("#order_tel").val()}`)
            }
            if ($("#order_you").val() != '') {
                $("#tbody3").children().eq(2).text(`${$("#order_you").val()}`)
            }
            if ($("#shi").val() != '' && $("#sheng").val() != '') {
                $("#tbody3").children().eq(3).text(`${$("#sheng").val()}${$("#shi").val()}`)
            }
        })
    </script>
</body>

</html>